#include "widget.h"
#include "ui_widget.h"
#include <thread>
#include <chrono>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    std::thread t([this]()
    {
        //先获取初始值
        int val = this->ui->lcdNumber->intValue();
        while(true)
        {
            //休眠1s
            std::this_thread::sleep_for(std::chrono::seconds(1));
            if(val <= 0)
                break;
            val -=1;
            this->ui->lcdNumber->display(val);
        }
    });
}

Widget::~Widget()
{
    delete ui;
}

